import { Graph } from '@antv/x6';
import { ConditionTypeEnum } from '../constant';

export function registerWhenNode() {
  Graph.registerNode(ConditionTypeEnum.WHEN, {
    inherit: 'rect',
    width: 80,
    height: 40,
    attrs: {
      body: {
        stroke: '#52C41A',
        strokeWidth: 1,
        fill: '#F6FFED',
      },
      label: {
        text: 'WHEN',
        fill: '#52C41A',
        fontSize: 12,
        textAnchor: 'middle',
        textVerticalAnchor: 'middle',
      },
    },
    ports: {
      groups: {
        in: {
          position: 'left',
          attrs: {
            circle: {
              r: 4,
              magnet: true,
              stroke: '#52C41A',
              strokeWidth: 1,
              fill: '#fff',
            },
          },
        },
        out: {
          position: 'right',
          attrs: {
            circle: {
              r: 4,
              magnet: true,
              stroke: '#52C41A',
              strokeWidth: 1,
              fill: '#fff',
            },
          },
        },
      },
      items: [
        {
          group: 'in',
          id: 'in',
        },
        {
          group: 'out',
          id: 'out',
        },
      ],
    },
  });
} 